package cn.airrunner.voicerecorder;

import android.app.Activity;
import android.content.Intent;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import java.io.IOException;

public class PlaybackActivity extends Activity
  implements View.OnClickListener
{
  private boolean mAutoProgress;
  int mDuration;
  Handler mHandler;
  private long mLastSeekEventTime;
  boolean mPlaying;
  private SeekBar.OnSeekBarChangeListener mSeekListener;
  private long mStartSeekPos;
  MediaPlayer mp;

  public PlaybackActivity()
  {
    MediaPlayer localMediaPlayer = new MediaPlayer();
    this.mp = localMediaPlayer;
    this.mPlaying = true;
    this.mStartSeekPos = 0L;
    this.mAutoProgress = null;
    PlaybackActivity.1 local1 = new PlaybackActivity.1(this);
    this.mHandler = local1;
    PlaybackActivity.2 local2 = new PlaybackActivity.2(this);
    this.mSeekListener = local2;
  }

  private void queueNextRefresh(long paramLong)
  {
    int i = 1;
    if (this.mp.isPlaying())
    {
      Message localMessage = this.mHandler.obtainMessage(i);
      this.mHandler.removeMessages(i);
      this.mHandler.sendMessageDelayed(localMessage, paramLong);
    }
  }

  private long refreshNow()
  {
    this.mAutoProgress = true;
    SeekBar localSeekBar = (SeekBar)findViewById(2131230728);
    long l1 = this.mp.getCurrentPosition();
    if ((l1 >= 0L) && (this.mDuration > 0))
    {
      long l2 = 100L * l1;
      long l3 = this.mDuration;
      int i = (int)(l2 / l3);
      localSeekBar.setProgress(i);
    }
    while (true)
    {
      return 500L;
      localSeekBar.setProgress(100);
    }
  }

  public void onClick(View paramView)
  {
    int i = 2131230727;
    if (this.mPlaying)
    {
      this.mPlaying = null;
      ((ImageButton)findViewById(i)).setImageResource(17301540);
      this.mp.pause();
    }
    while (true)
    {
      return;
      this.mPlaying = true;
      ((ImageButton)findViewById(i)).setImageResource(17301539);
      this.mp.start();
      long l = SystemClock.elapsedRealtime();
      Object localObject;
      this.mLastSeekEventTime = localObject;
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903041);
    ((ImageButton)findViewById(2131230727)).setOnClickListener(this);
    SeekBar localSeekBar = (SeekBar)findViewById(2131230728);
    SeekBar.OnSeekBarChangeListener localOnSeekBarChangeListener = this.mSeekListener;
    localSeekBar.setOnSeekBarChangeListener(localOnSeekBarChangeListener);
  }

  protected void onPause()
  {
    this.mp.stop();
    super.onPause();
  }

  protected void onRestart()
  {
    super.onRestart();
  }

  protected void onResume()
  {
    super.onResume();
  }

  protected void onStart()
  {
    if (this.mp.isPlaying())
      this.mp.stop();
    String str1 = getIntent().getExtras().getString("filepath");
    ((TextView)findViewById(2131230724)).setText(str1);
    try
    {
      this.mp.setDataSource(str1);
      this.mp.prepare();
      long l1 = this.mp.getDuration() / 1000;
      StringBuilder localStringBuilder1 = new StringBuilder();
      long l2 = l1 / 60L;
      String str2 = l2 + ":";
      if (l1 % 60L < 10L)
      {
        String str3 = String.valueOf(str2);
        str2 = str3 + "0";
      }
      String str4 = String.valueOf(str2);
      StringBuilder localStringBuilder2 = new StringBuilder(str4);
      long l3 = l1 % 60L;
      String str5 = l3;
      ((TextView)findViewById(2131230726)).setText(str2);
      ((AudioManager)getSystemService("audio")).setSpeakerphoneOn(true);
      int i = this.mp.getDuration();
      this.mDuration = i;
      this.mp.start();
      long l4 = SystemClock.elapsedRealtime();
      Object localObject;
      this.mLastSeekEventTime = localObject;
      queueNextRefresh(500L);
      super.onStart();
      return;
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      while (true)
        localIllegalArgumentException.printStackTrace();
    }
    catch (IllegalStateException localIllegalStateException)
    {
      while (true)
        localIllegalStateException.printStackTrace();
    }
    catch (IOException localIOException)
    {
      while (true)
        localIOException.printStackTrace();
    }
  }
}

/* Location:           C:\Documents and Settings\Administrator\桌面\Voicerecorder\classes.dex.dex2jar.jar
 * Qualified Name:     cn.airrunner.voicerecorder.PlaybackActivity
 * JD-Core Version:    0.6.0
 */